import 'package:flutter_module/page/Book/add_book/add_book_view.dart';
import 'package:flutter_module/page/account_setting/account_setting_view.dart';
import 'package:flutter_module/page/apply/history/apply_history_view.dart';
import 'package:flutter_module/page/test_demo/test_demo_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/flutter_boost.dart';
import '../../page/Book/book_search/book_search_view.dart';
import '../../page/search/search_colleague/search_colleague_view.dart';
import '../../page/welfare_ranking/welfare_ranking_home_view.dart';
import 'RouterParams.dart';
import 'RouterPath.dart';

class YouthRoute {
  ///定义flutter_boost页面路由
  static final Map<String, FlutterBoostRouteFactory> routerMap = {
    '/': (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            return TestDemoPage();
          });
    },
    ROUTER_ACCOUNT_SETTING: (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            Map<String, dynamic> map =
                settings.arguments as Map<String, dynamic>;
            String phoneNumber = map[PARAM_PHONE_NUMBER] as String;
            return AccountSettingPage(
              phoneNumber: phoneNumber,
            );
          });
    },
    ROUTER_ADD_BOOK_PAGE: (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            debugPrint("1111111C$settings.arguments");
            Map<String, dynamic> map =
                settings.arguments as Map<String, dynamic>;
            String bookName = map[PARAM_BOOK_NAME] as String;
            return AddBookPage(
              bookName: bookName,
            );
          });
    },
    ROUTER_BOOK_SEARCH: (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            return BookSearchPage();
          });
    },
    ROUTER_SEARCH_COLLEAGUE: (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            Map<String, dynamic> map =
                settings.arguments as Map<String, dynamic>;
            return SearchColleaguePage(
              orgSignificantDepartmentId:
                  map[PARAM_orgSignificantDepartmentId] as int,
            );
          });
    },
    ROUTER_APPLY_HISTORY: (settings, uniqueId) {
      return MaterialPageRoute(
          settings: settings,
          builder: (_) {
            Map<String, dynamic> map =
                settings.arguments as Map<String, dynamic>;
            return ApplyHistoryPage(
                applyCount: map[PARAM_APPLY_COUNT] as String);
          });
    },
    ROUTER_WELFARE_RANKING: (settings, uniqueId) {
      return MaterialPageRoute(
        settings: settings,
        builder: (_) {
          Map<String, dynamic> map = settings.arguments as Map<String, dynamic>;
          return WelfareRankingHomePage(
              countingType: map[WELFARE_COUNTING_TYPE] as int,
              timeType: map[WELFARE_TIME_TYPE] as int);
        },
      );
    },
    ROUTER_TEST_PAGE: (settings, uniqueId) {
      return MaterialPageRoute(
        settings: settings,
        builder: (_) {
          Map<String, dynamic> map = settings.arguments as Map<String, dynamic>;
          return TestDemoPage();
        },
      );
    },
  };
}
